package com.matt.domain.statistics;

import com.matt.foundation.model.Domain;
import com.matt.foundation.utils.DateUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/7/17
 * 预期收入统计
 * *******************************
 */
@Data
@Entity
@Table(name = "stat_expect_income")
@EqualsAndHashCode(callSuper = true)
public class StatExpectIncome extends Domain{

    @Column(columnDefinition = "varchar(32)  COMMENT '对应客户id'")
    private String clienteleId;

    @Column(columnDefinition = "varchar(32)  COMMENT '对应合同id'")
    private String contractId;

    @Column(columnDefinition = "decimal(12, 2) COMMENT '价格'")
    private BigDecimal amount;

    @Column(columnDefinition = "int default 1 COMMENT '类型 1:新客户收入  2：续单收入'")
    private Integer type;

    @Column(columnDefinition = "int default 1 COMMENT '类型 1:托班  2：早教'")
    private Integer productType;

    @Column(columnDefinition = "varchar(32) COMMENT '对应园区 id'")
    private String areaId;

    public static StatExpectIncome of(String clienteleId, String contractId, BigDecimal amount, Integer type, Integer productType, String areaId, Date date){
        StatExpectIncome income = new StatExpectIncome();
        income.setClienteleId(clienteleId);
        income.setContractId(contractId);
        income.setAmount(amount);
        income.setType(type);
        income.setAreaId(areaId);
        income.setProductType(productType);
        income.setCreated(date);
        return income;
    }
}
